home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / shutdown.pxl < prev    next >
Text File  |  2000-12-23  |  4KB  |  165 lines

  1. {    Filename    :     shutdown.pxl
  2.      Purpose    :    Show how to logoff and shutdown Windows
  3.     Date        :    March 30, 2000
  4.     Author        :    Stewart DIBBS, VYSOR
  5. History:
  6.  
  7.     Version    :  4.40    RELEASE
  8.     Update        :  
  9.     Date        :  
  10.  
  11. --------------------------------------------------------------------------}
  12. Initialize: {only one instance allowed}
  13.     UseCoordinates(PIXEL)
  14.     Title$ = "Exitting Windows ..."                                  
  15.     WinExist(Title$,Res)
  16.     If Res = 0 Then Goto One_Instance
  17.     Beep
  18.     WinSetActive(Title$,Res)
  19.     WinShow(Title$,RESTORE,Res)
  20.     End
  21. One_Instance:
  22.     UseCaption(Title$) {change the title}
  23.     WinLocate(Title$,378,120,758,368,Res)                
  24.     UseBackground(TRANSPARENT,255,255,255)     
  25.     WinShow(Title$,NOTOPMOST,Res) 
  26.     DrawBackGround
  27.     DirGet(SourceDir$) {used later for library function calls}
  28.  
  29.     {DragAcceptFile(ENABLE,AcceptFile)}
  30.     AutoProgressBar(DISABLE)
  31.  
  32.     InfoMenu(REMOVE)
  33.     WaitInput(100)
  34.     SetMenu("&File",IGNORE,
  35.         "&New",CreatingFile,
  36.         "&Open",OpeningFile,
  37.         "&Save",SavingFile,
  38.         "Save &All",SavingAllFiles,
  39.         SEPARATOR,
  40.         "E&xit!",Terminate,
  41.         ENDPOPUP,
  42.         "&View",IGNORE,
  43.         "&ToolBar",ViewToolBar,
  44.         "&StatusBar",ViewStatusBar,
  45.         ENDPOPUP,
  46.         "&Information",IGNORE,
  47.         "&Concept",Concept,
  48.         "&Help",ShowAppHelp,
  49.         SEPARATOR,
  50.         "&About",About,
  51.         ENDPOPUP)
  52.  
  53.     GoSub MakeToolbar
  54.     ChangeMenuItem("&ToolBar",CHECK,TBRes)
  55.  
  56.         
  57.     StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  58.     DrawStatusWinText(0,"Ready")
  59.     ChangeMenuItem("&StatusBar",CHECK,SBRes)
  60.  
  61.         
  62.  
  63.     
  64. Wait_for_Input:
  65.     WaitInput()
  66.  
  67. Terminate:
  68.     End
  69.  
  70.  
  71. Concept:
  72.     MessageBox(OK,1,INFORMATION,
  73. "This is a skeleton of a PiXCL application.  You could briefly
  74. describe your application's function here, or provide some
  75. basic help information.",
  76.     "PiXCL Skeleton Concept",Res)
  77.  
  78.     Goto Wait_for_Input
  79.  
  80. ShowAppHelp:
  81.     {An application Help file usually has the same name as the application.}
  82.     Winhelp("shutdown.hlp",CONTENTS,"")
  83.  
  84.     Goto Wait_for_Input
  85.  
  86. About:
  87.     AboutUser("Exitting Windows ...",  { or substitute Title$}
  88.       "Two lines of text goes here e.g. Application function.",
  89.     "Four Lines of additional information goes here, perhaps contact information and Web addresses")   
  90.  
  91.     Goto Wait_for_Input
  92.  
  93. ViewToolBar:
  94.     GetMenuStatus("&ToolBar",CHECKED,Res)
  95.     If Res = 0
  96.         GoSub MakeToolbar
  97.         ChangeMenuItem("&ToolBar",CHECK,Res)
  98.     Else
  99.         Toolbar()
  100.         ChangeMenuItem("&ToolBar",UNCHECK,Res)
  101.     Endif
  102.     Goto Wait_for_Input
  103.  
  104. ViewStatusBar:
  105.     GetMenuStatus("&StatusBar",CHECKED, Res)
  106.     If Res = 0
  107.         StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  108.         DrawStatusWinText(0,"Ready")
  109.         ChangeMenuItem("&StatusBar",CHECK,Res)
  110.     Else
  111.         StatusWindow(DISABLE,BOTTOM,2,200,-1,0,0)
  112.        ChangeMenuItem("&StatusBar",UNCHECK,Res)
  113.     Endif
  114.     Goto Wait_for_Input
  115.  
  116. CreatingFile:
  117.     WaitInput(1)
  118.     Logoff
  119.     End
  120.  
  121. OpeningFile:
  122.     WaitInput(1)
  123.     GetComputerName(ComputerName$)
  124.     Shutdown(ComputerName$,"Please close your applications",30,NORESTART)
  125.     Goto Wait_for_Input
  126.  
  127. SavingFile:
  128.     WaitInput(1)
  129.     AbortShutdown
  130.     Goto Wait_for_Input
  131.  
  132. SavingAllFiles:
  133.     WaitInput(1)
  134.     ExitWindows(REBOOT)
  135.     Goto Wait_for_Input
  136.  
  137.  
  138. PrintingFile:
  139.     WaitInput(1)
  140.     {TODO: add file handling here}
  141.     MessageBox(OK,1,INFORMATION,"No operations coded for this button.",
  142.                     "Printing File",Res)
  143.     Goto Wait_for_Input
  144.  
  145. AcceptFile:
  146.     GetDragList(FileList$)
  147.     {TODO: add file list handling here, or delete this whole label handler}
  148.     Goto Wait_for_Input
  149.     
  150. {--- Style Suggestion: place all subroutines at the end of the script.}
  151.  
  152. MakeToolbar: {subroutine}
  153.     Toolbar(RAISED, PXL_SMALL,
  154.         NULL, NULL, SEPARATOR, "", Wait_for_Input, 
  155.         PXL_NEW, ENABLED, STD, "Logging Off", CreatingFile,
  156.         PXL_OPEN, ENABLED, STD, "Shutting Down", OpeningFile, 
  157.         PXL_SAVE, ENABLED, STD, "Abort Shutdown", SavingFile, 
  158.         SAVEALL,  ENABLED, STD,"Exitting", SavingAllFiles,
  159.         PXL_PRINT,  ENABLED, STD,"PrintFile", PrintingFile, 
  160.         NULL, NULL, SEPARATOR, "", Wait_for_Input, 
  161.         HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp) 
  162.  
  163.     Return
  164.  
  165.